package gui.keyActions;

import gui.MainPanel;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import dados.Curva;

public class SetAllSecondaryPolygonalsVisibility extends AbstractAction {
	private MainPanel target;

	public SetAllSecondaryPolygonalsVisibility(MainPanel target) {
		super();
		this.target = target;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		this.target.getDrawPanel().setAllSecondaryPolygonalsVisible(!this.target.getDrawPanel().isAllSecondaryPolygonalsVisible());
		for (Curva c : this.target.getDrawPanel().getDraw().getCurves()) {
			c.setSecondaryPolygonalsVisible(this.target.getDrawPanel().isAllSecondaryPolygonalsVisible());
		}
		this.target.getDrawPanel().update();

		this.target.getButtonPanel().getCheckBoxPoligonaisSecundarias().setSelected(this.target.getDrawPanel().isAllSecondaryPolygonalsVisible());

	}

}
